# Author: Yu Bin
# Date: 2024/12/30 14:46:06
# E-mail: 853823259@qq.com



class Tool:
    count = 0  # 类属性，类似于类的全局变量

    def __init__(self, name):
        self.name = name
        Tool.count += 1
    def func(self):
        print(f'{self.name}可以做很多事情')

    @classmethod
    def show_tool_count(cls):
        """

        :return:
        """
        print("工具对象的总数 %d" % cls.count)

if __name__ == '__main__':
    tool1 = Tool('斧子')
    print(Tool.count)
    tool2 = Tool('锤子')
    print(Tool.count)
    print(Tool.show_tool_count())
